<!doctype html>
<html>
    <head>
        <meta charset="utf-8">
        <title>抱抱堂-摇摇乐</title>
        <meta name="renderer" content="webkit">
        <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="{:C('IMG_PATH')}/static/css/main.css?v=12">
  <style>
    .wallet{
        background: url("{:C('IMG_PATH')}/static/img/deposit1.png");
        background-repeat: no-repeat;
        background-size: 100% auto;
        margin: 1vh 5vw;
        height: 60vw;
        position: relative;
    }
    .wallet > div{
        position: absolute;
        font-size: 5vw;
        color: #fff;
        line-height: 1em;
    }
    .wallet .money{
        top:20vw;
        width: 100%;
        text-align: center;
        font-size: 4.5vw;
    }
    .wallet .deposit{
        top:47vw;
        text-align: center;
        width: 100%;
    }
    .wallet .money_input{
        /*margin-top: 4vw;*/
        top:28vw;
        width: 100%;
        text-align: center;
        font-size: 4.5vw;
    }
    .wallet .money_input input{
        width: 50vw;
        height: 8vw;
        font-size: 1.2em;
        border: none;
    }
    /*.wallet .money .money_input{
        margin-top: 4vw;
    }
    .wallet .money .money_input input{
        width: 49vw;
        height: 8vw;
        font-size: 1.2em;
        border: none;
    }*/
    .wallet .deposit span{
        font-size:1.2em;
        color:#FDD135;
    }
    .submit{
        text-align: center;
    }
    .submit .button1{
        width: 40vw;
        height: 10.5vw;
        background: url("{:C('IMG_PATH')}/static/img/deposit2.png");
        background-repeat: no-repeat;
        background-size: 100% auto;
        border: none;
    }
    .submit .button2{
        width: 40vw;
        height: 11vw;
        background: url("{:C('IMG_PATH')}/static/img/deposit4.png");
        background-repeat: no-repeat;
        background-size: 100% auto;
        border: none;
    }
    /*.submit button{
        width: 40vw;
        height: 10.5vw;
        background: url("{:C('IMG_PATH')}/static/img/deposit2.png");
        background-repeat: no-repeat;
        background-size: 100% auto;
        border: none;
    }*/
    .rule{
        font-size: 4vw;
        line-height: 1.4em;
        color: #C3C3C3;
        margin: 0 5vw;
    }
    .rule p:first-child{
        text-align: center;
    }
    .rule p:last-child{
        font-size: 3vw;
        margin-top: 4vw;
    }
    .rule h4{
        font-size: 4vw;
        text-align: center;
        margin: 5vw 0 0 0;
        border-top: 1px solid #C3C3C3;
        line-height: 1px;
    }
    .rule h4 span{
        background-color:#F0EFF5;
        padding: 0 2vw;
    }
  </style>
</head>
<body class="mycard-bg">
  <header class="mycard">
          <a href="{:U('Portal/index/xiangxi')}"><img src="{$user_info.avatar}" /></a>
          <h4>{$user_info.nickname}</h4>
  </header>
  	<if condition="$real['adimg']" >
      <section class="list-adv">
			<a href="{$real.adurl}">
				<img src="{:C('IMG_PATH')}{$real.adimg}" />
			</a>
      </section>
   </if>
  <section>
      <div class="wallet">
          <div class="money">提现金额</div>
          <div class="money_input"><input type="number" id="tx_amount" placeholder="输入提现金额"></div>
          <div class="deposit">当前余额：<span>{$money}</span>元</div>
      </div>
  </section>
  <if condition="$tixian_count_used_month elt $tixian_count_total_month && $money egt 99999" >
	  <section class="submit">
	      <button type="submit" class="button1" id="deposit-btn"></button>
	  </section>
  </if>
	  <section class="submit">
	      <button type="submit" class="button2"  id="deposit-btn2"></button>
	  </section>
  <section class="rule">
      <p>最低提现金额为10元,每月可提现{$tixian_count_total_month}次，现已用{$tixian_count_used_month}次</p>
      <h4 style="margin-bottom: 15px;"><span>提现规则</span></h4>
      <p>
          1. 为了更好地保证您的资金安全，提现需要审核，审核在1个工作日内完成。<br>
          2. 请您尽量完善您的微信资料，完成微信实名认证，以享有更高的微信提现额度。<br>
          3. 每月可提现3次，满10元可申请提现。<br>
          4. 提现审核结果请留意微信公众号消息。<br>
          5. 每次最高提现200元。
      </p><br><br><br>
  </section>
  <footer class="white"><img src="{:C('IMG_PATH')}/static/img/logo_gray.png" /></footer>
</body>
    <script src="{:C('IMG_PATH')}/static/zepto.min.js"></script>
    <script>
    (function(){
        $("#deposit-btn2").on("click", function(){
            window.location.href = "{:U('Portal/index/duobao')}";
        });
        $("#deposit-btn").on("click", function(){
            // 提现
            tx_amount = $('#tx_amount').val();
            Balance = {$money};
            if (!tx_amount) {
                alert('提现金额不能为空!');
                return false;
            }
            if (tx_amount < 10) {
                alert('提现金额不能小于10元!');
                return false;
            }
            if (tx_amount > Balance) {
                alert('输入的金额不能大于当前的账户余额!');
                return false;
            }
            $.ajax({
                url : "{:U('Portal/api/tixian')}",
                cache : false,
                type : "POST",
                dataType : "json",
                data : {money: tx_amount*100},
                success : function(msg, textStatus){
                    if (msg.errcode == 0) {
                        if (msg.data.status == 0) {
                            //alert("提现成功，红包已经通过服务号发放给你，请注意领取");
                            window.location.href = "{:U('Portal/index/getdepositsuccess')}";
                        }
                        if (msg.data.status == 1) {
                            alert("提现金额不能小于10元哦!");
                        }
                        if (msg.data.status == 2) {
                            alert("提现失败，请稍后重试");
                        }
                        if (msg.data.status == 3) {
                            alert("提现失败，1分钟内只能提现1次哦。");
                        }
                        if (msg.data.status == 4) {
                            alert("输入的金额不能大于当前的账户余额");
                        }
                        if (msg.data.status == 5) {
                            alert("提现金额不能为空");
                        }
                        if (msg.data.status == 6) {
                            alert("本月提现次数已用完, 请下月再来提现!");
                        }
                        return;
                    }
                    alert(msg.errmsg);
                },
                error : function(){
                    alert("提现失败，请稍后重试");
                }
            });
        });
    })();
    </script>
</html>
